﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using ProjectPigs.Util;

namespace ProjectPigs
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Audio;
    using Microsoft.Xna.Framework.Content;
    using Microsoft.Xna.Framework.GamerServices;
    using Microsoft.Xna.Framework.Graphics;
    using Microsoft.Xna.Framework.Input;
    using Microsoft.Xna.Framework.Media;
    using Microsoft.Xna.Framework.Net;
    using Microsoft.Xna.Framework.Storage;



        class Debug
        {
            static String[,] entries = new String[5, 20];
            static Texture2D bg = SystemInfo.black;
            static Rectangle rect = new Rectangle(0, 0, SystemInfo.windowSize.Width, 200);
            static Boolean visible = true;

            public static String getEntry(int x, int y)
            {
                return entries[x, y];
            }

            public static void pushEntry(String entry, int x)
            {
                for (int i = 0; i < 19; i++)
                {
                    entries[x, i] = entries[x, i + 1];
                }

                entries[x, 19] = entry;
            }

            public static void setEntry(String entry, int x, int y)
            {
                entries[x, y] = entry;
            }

            public static void toggleVisibility()
            {
                if (visible)
                {
                    visible = false;
                }
                else
                {
                    visible = true;
                }
            }

            public static void draw(SpriteBatch sb)
            {
                if (visible)
                {
                    SpriteFont font = SystemInfo.normalFont;
                    int xIncr = 800 / 5;

                    sb.Draw(bg, rect, new Color(0f, 0f, 0f, 0.4f));

                    for (int a = 0; a < 5; a++)
                    {
                        for (int b = 0; b < 20; b++)
                        {
                            if (entries[a, b] != null)
                                Text.drawString(font, entries[a, b], new Rectangle(xIncr * a, b * 10, xIncr, 10), Text.LEFT);
                        }
                    }
                }
            }

        }
    

}
